<template>
  <el-card>
    <ikechenform
      :model="form"
      :elem="fromData"
      :submit="true"
      :reset="true"
      :button="false"
      okIcon="Search"
      btnSize="small"
      submitText="搜索"
      @onSuccess="onSuccess"
      @onReset="clcikReset"
    />
    <itable :table="tconfig.tableConfig" :tableData="tconfig.tableData" :page-bean="tconfig.pageBean" @pageChange="pageChange">
      <template #searchBox>
        <el-button size="small" type="primary">添加预警</el-button>
        <el-button size="small" type="danger">批量删除</el-button>
      </template>
    </itable>
  </el-card>
</template>

<script setup lang='ts'>
import { reactive, ref } from 'vue';
import itable from '@/components/table/table.vue'
import { PageBean } from "@/utils/page-bean";
import ikechenform from "components/ITable/index.vue";

let fromData = reactive([
    {
      label: "操作人",
      prop: "value",
      clearable: true,
    },
    {
      element:'select',
      label: "日志类型",
      prop: "logType",
      option:[
        {label:'11',value:'1'}
      ],
      clearable: true,
    }
])
let form = reactive({
  value:'',
  logType:'',
})
const tconfig = reactive({
  tableConfig: {} as {loading:boolean,[propName:string]:any},
  tableData: [{currenttime:'1',costtime:'2',onreason:'3',watermeter:'true'}] as any[],
  pageBean: new PageBean(10, 1, 0),
})
const clcikReset = () => {
  console.log('77')
}
const onSuccess = (form) => {
  console.log(form)
}
const pageChange = () => {

}

// 初始化表格
const initTable = () => {
  tconfig.tableConfig = {
    loading: false,
    hasSelect: false,
    hasIndex: true,
    hasOperation: true,
    hasSearch: true,
    hasPage: false,
    tr: [
      {
        label: "预警类别",
        minWidth: "140",
        prop: "currenttime",
      },
      {
        label: "预警类别说明",
        minWidth: "110",
        prop: "costtime",
      },
      {
        label: "预警通知人员",
        minWidth: "160",
        prop: "onreason",
      }
    ],
    operation:{
      label:'操作',
      data:[
        {label:'查看', icon:'el-icon-s-operation', size:'small', type:'text',classname:'look'},
        {label:'编辑', icon:'el-icon-edit', size:'small', type:'text',classname:'compile'},
        {label:'删除', icon:'el-icon-delete', size:'small', type:'text',classname:'delete'}
      ]
    }
  }
}
initTable()
</script>

<style lang='scss' scoped>

</style>
